package cn.itcast.redis;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;

public class demo2 {
	public static void main(String[] args) {
		
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:spring/applicationContext-springdataredis.xml");
		RedisTemplate<String, String> redisTemplate = (RedisTemplate<String, String>) ctx.getBean("redisTemplate");
		
		System.out.println(redisTemplate.opsForValue().get("卧槽"));
		
		
		/*//读取spring的配置文件
		ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/applicationContext-springdataredis.xml");
		//获取bean
		RedisTemplate<String,String> redisTemplate = (RedisTemplate<String, String>) context.getBean("redisTemplate");
		//操作redis数据库
		System.out.println(redisTemplate.opsForValue().get("卧槽"));*/
	}
}
